/**
 * 
 */
package uk.co.cdal.cobweb.frontend.GUI;

import java.awt.Graphics;

/**
 * @author seb
 *
 */
public class SpiderEdge extends Edge {
	
	private SpiderNode parent;
	
	private SpiderNode child;
	
	public SpiderEdge(SpiderNode parent, SpiderNode child) {
		this.parent = parent;
		this.child = child;
	}
	
	/**
	 * Remove this edge from the diagram
	 *
	 */
	public void remove() {
		parent.getIdea().removeChild(child.getIdea());
	}
	
	public SpiderNode getChild()
	{
		return child;
	}
	
	public SpiderNode getParent()
	{
		return parent;
	}
	
	/**
	 * Draws a line representing a connection between nodes
	 * using the given grpahics object.
	 * 
	 * @param g The graphics object to draw the line with.
	 */
	public void draw(Graphics g) {
		g.drawLine(parent.getCenterX(), parent.getCenterY(), child.getCenterX(), child.getCenterY());
	}
}
